home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / clang / ebksrc.zip / PCWIN.HPP < prev    next >
C/C++ Source or Header  |  1991-07-30  |  2KB  |  83 lines

  1. /*
  2.  
  3.     pcwin.hpp
  4.     7-30-91
  5.     Text windowing class
  6.  
  7.     Copyright 1991
  8.     John W. Small
  9.     All rights reserved
  10.     Use freely but acknowledge authorship and copyright.
  11.  
  12.     PSW / Power SoftWare
  13.     P.O. Box 10072
  14.     McLean, Virginia 22102 8072 USA
  15.  
  16.     Voice: (703) 759-3838
  17.     CIS: 73757,2233
  18.  
  19. */
  20.  
  21. #ifndef PCWIN_HPP
  22. #define PCWIN_HPP
  23.  
  24. #ifndef PCCURSOR_HPP
  25. #include <pccursor.hpp>
  26. #endif
  27. #ifndef PCVIDEO_HPP
  28. #include <pcvideo.hpp>
  29. #endif
  30. #ifndef PCFRAME_HPP
  31. #include <pcframe.hpp>
  32. #endif
  33.  
  34. class TextScreenState  {
  35.     CursorShape cursor;
  36.     int oattr, owscroll, odirectvideo;
  37.     int ol, ot, or, ob, ox, oy;
  38. public:
  39.     void save();
  40.     void restore();
  41. };
  42.  
  43. class TextWindow  {
  44.     TextScreenState prevTxtScrState;
  45.     static int dbuf[];
  46.     PalettE P;
  47.     int l, t, r, b;
  48.     char *buf;
  49.     int castShadow, openned;
  50.     enum BSTYLE bs;
  51.     int statusLine;
  52.     void dressing(const unsigned char *msg, int d);
  53. public:
  54.     static Palette defaultP;
  55.     CursorShape cursor;
  56.     enum TW_PALETTE { COLOR, FRAME, TITLE, FOOTER,
  57.         STATUS, NORMAL, HILITE, AUX };
  58.     void setPalette(PalettE P = PalettE0)
  59.         { this->P = (P? P : defaultP); }
  60.     int mapattr(enum TW_PALETTE attr_id)
  61.         { return ::mapattr(attr_id,P); }
  62.     void mapvideo(enum TW_PALETTE attr_id)
  63.         { ::mapvideo(attr_id,P); }
  64.     TextWindow(PalettE P = PalettE0) { buf = (char *)0;
  65.         openned = 0; setPalette(P); }
  66.     int window(int left, int top, int right,
  67.         int bottom, enum BSTYLE bs = DOUBLE_FRAME,
  68.         int statusLine = 0, int saveShadow = 1,
  69.         int castShadow = 1);
  70.     void putTitle(const char *msg)
  71.         { dressing((const unsigned char *)msg,1); }
  72.     void putFooter(const char *msg)
  73.         { dressing((const unsigned char *)msg,2); }
  74.     void putStatus(const char *msg)
  75.         { dressing((const unsigned char *)msg,3); }
  76.     void close();
  77.     ~TextWindow() { close(); }
  78. };
  79.  
  80. #define MAX_TW_DBUF  132
  81.  
  82. #endif
  83.